package com.lw.system.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.lw.system.model.User;

/**
 * 
 * @Description: 首页
 * @author wei.liu
 * @date 2016年12月23日 下午3:31:33
 * @version V1.0
 */

@RestController
public class IndexController {
	/**
	 * 
	 * @Description:跳转到首页
	 * @return
	 */
	@RequestMapping(value = "/")
	public ModelAndView t() {
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.setViewName("index");
		return modelAndView;
	}

	@RequestMapping(value = "/r")
	public ResponseEntity<ModelMap> t2(ModelMap modelMap) {
		modelMap.put("obj", "ss");
		modelMap.put("statusCode", "200");
		modelMap.put("msg", "1111");
		return ResponseEntity.ok(modelMap);
	}

	@PostMapping(value = "/s/us")
	public ResponseEntity<User> t3(User u) {
		return ResponseEntity.ok(u);
	}

	@PostMapping(value = "/y/us" )
	public ResponseEntity<User> t4(@RequestBody User u) {
		return ResponseEntity.ok(u);
	}

}
